const { access, constants } = require('fs')

function testExists(file) {
    access(file, constants.F_OK, err => {
        console.log(`${file} ${err ? 'not exist' : 'exists'}`)
    })
}

testExists('package.json')
testExists('data.txt')
